package com.hp.controller;

import com.hp.pojo.Renting;
import com.hp.service.RentingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController

public class RentingController {
    @Autowired private RentingService rentingService;

    @PostMapping("/getAllRentings")
    Map<String,Object> getAllRentings (){
        return rentingService.getAllRentings();
    }

    @PostMapping("getRentingsAll")
    Map<String,Object> getRentingsAll() {
        return rentingService.getRentingsAll();
    }

    @PostMapping("/getAllRentingsByHouseId")
    Map<String,Object> getAllRentingsByHouseId (int houseId){
        /*
        获取所有rentings
         */
        return rentingService.getAllRentingsByHouseId(houseId);
    }
    @PostMapping("/changeRenting_Apply")
    Map<String,String> changeRenting_Apply (int rentingId){
        //修改某租房记录的申请状态
        return rentingService.changeApply(rentingId);
    }

    @PostMapping("/addRenting")
    Map<String,String> addRenting (Renting renting){
        //增加 一个renting
        return rentingService.addRenting(renting);
    }

    @PostMapping("/getAgentRenting")
    Map<String,Object> getAgentRenting (){
        return rentingService.getAgentRenting();
    }

}
